<template>
    <div class="wage-calculator">
        <h1>牛马收益</h1>
        <div class="content">
            <div class="info">
                <div class="info-header">
                    <div class="rol"></div>
                    <div class="line"></div>
                </div>
                <h2>计算公式：</h2>
                <p>工作性价比 = 平均日薪综合环境系数 / 35 * (工作市场+通勤时长-0.5X横鱼时长) * X学历指数</p>
                <h2>最终结果说明：</h2>
                <p>&lt; 0.8 就不幸福<br />> 1.5 说明工作已经很爽了<br />> 2.0 代表有份神仙工作</p>
                <h2>系数说明：</h2>
                <p>平均日薪 = 月薪 / 工作天数<br />综合环境系数 = 工作环境系数 * X异性环境系数 * X同事环境系数<br />各类时间：<br />工作时长 = 下班时间 -
                    上班时间<br />通勤时长 = 上班通勤 + 下班通勤<br />横鱼时长 = 不干活时长 + 吃饭时长 + 午休时长</p>
            </div>
            <div class="calculator-container">
                <div class="calculator">
                    <div class="header">工作性价比计算器</div>
                    <div class="input-group">
                        <label>您的工作环境：</label>
                        <div class="radio-group">
                            <label class="radio-label"><input type="radio" v-model="workEnv" name="work-env" value="1">偏僻地区或郊区的工厂、工地、艰苦户外等工作环境</label>
                            <label class="radio-label"><input type="radio" v-model="workEnv" name="work-env" value="2">工厂、工地、艰苦户外等工作环境</label>
                            <label class="radio-label"><input type="radio" v-model="workEnv" name="work-env" value="3">普通环境</label>
                            <label class="radio-label"><input type="radio" v-model="workEnv" name="work-env" value="4">CBD、体制内等工作环境</label>
                        </div>
                    </div>
                    <div class="input-group">
                        <label>您的异性环境：</label>
                        <div class="radio-group">
                            <label class="radio-label"><input type="radio" v-model="attractiveEnv" name="attractive-env" value="5">周围没有好看异性</label>
                            <label class="radio-label"><input type="radio" v-model="attractiveEnv" name="attractive-env" value="6">周围好看的异性不多不少</label>
                            <label class="radio-label"><input type="radio" v-model="attractiveEnv" name="attractive-env" value="7">周围很多好看异性</label>
                        </div>
                    </div>
                    <div class="input-group">
                        <label>您的同事环境：</label>
                        <div class="radio-group">
                            <label class="radio-label"><input type="radio" v-model="colleagueEnv" name="colleague-env" value="8">周围脑残同事较多</label>
                            <label class="radio-label"><input type="radio" v-model="colleagueEnv" name="colleague-env" value="9">周围基本上都是普通同事</label>
                            <label class="radio-label"><input type="radio" v-model="colleagueEnv" name="colleague-env" value="10">周围优秀同事较多</label>
                        </div>
                    </div>
                    <button @click="calculateRealTimeWage">开始计算</button>
                </div>
            </div>
        </div>
    </div>
</template>

<script>
    export default {
        data() {
            return {
                workEnv: '',
                attractiveEnv: '',
                colleagueEnv: ''
            };
        },
        methods: {
            calculateRealTimeWage() {
                const { workEnv, attractiveEnv, colleagueEnv } = this;
                if (!workEnv || !attractiveEnv || !colleagueEnv) {
                    window.alert('检测到输入数据有空值，请选择完整后再提交。');
                    return;
                }
                this.$router.push({
                    path: '/priceViewResult',
                    query: {
                        ...this.$route.query,
                        workEnv: this.workEnv,
                        attractiveEnv: this.attractiveEnv,
                        colleagueEnv: this.colleagueEnv
                    }
                });
            }
        }
    };
</script>

<style scoped>
    * {
        margin: 0;
        padding: 0;
        box-sizing: border-box;
    }

    .content {
        display: flex;
        justify-content: center;
        align-items: flex-start;
        width: 100vw;
        height: 100vh;
    }

    .wage-calculator {
        width: 100vw;
        height: 100vh;
        background-color: #888;
        padding: 20px;
        text-align: center;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
    }

    h1 {
        color: white;
        width: 548px;
        height: 157px;
        font-size: 100px;
        font-family: STXinwei;
    }

    .calculator-container {
        width: 50%;
        height: 80%;
        background-color: white;
        border-radius: 10px;
        box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        margin-left: 20px;
    }

    .info {
        width: 30%;
        height: 80%;
        background-color: white;
        border-radius: 10px;
        padding: 20px;
        box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
        font-size: 20px;
        text-align: left;
    }

    .info-header {
        width: 100%;
        height: 50px;
    }

    .rol {
        width: 50px;
        height: 50px;
        background-color: #f0c040;
        border-radius: 50%;
    }

    .line {
        border-bottom: 5px dashed black;
    }

    .calculator {
        width: 100%;
        height: 100%;
        background-color: #f9f9f9;
        padding: 20px;
        border-radius: 10px;
    }

    .header {
        width: 100%;
        /* height: 40%; */
        background-color: #f0c040;
        color: white;
        padding: 10px;
        border-radius: 10px;
        font-weight: bold;
        margin-bottom: 20px;
    }

    .input-group {
        width: 100%;
        margin-bottom: 15px;
        text-align: left;
        font-size: 30px;
    }

    .radio-group {
        display: flex;
        flex-wrap: wrap;
    }

    .radio-label {
        margin-bottom: 10px;
        font-size: 18px;
        color: black;
        margin: 10px;
    }

    input[type="radio"] {
        margin-right: 10px;
    }

    label {
        display: block;
        margin-bottom: 5px;
        color: #f0c040;
    }

    button {
        background-color: #f0c040;
        color: white;
        padding: 10px 20px;
        border: none;
        border-radius: 4px;
        cursor: pointer;
    }
</style>